﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IMCOM.Imagiality.ImageProcessing.Canvas2D.AutoContrast
{

    public class AutoContrastImageEventListener : Canvas2DImageEventListener
    {
        private Canvas2DAutoContrastState autoContrastState;
        private Canvas2DAutoContrastCalculator autoContrastCalculator;

        private Canvas2DGUI canvas2DGui;

        public Canvas2DAutoContrastCalculator Calculator
        {
            get 
            {
                return autoContrastCalculator;
            }
        }

        public AutoContrastImageEventListener(Canvas2DGUI gui, Canvas2DAutoContrastCalculator calculator)
        {
            this.canvas2DGui = gui;
            this.autoContrastCalculator = calculator;
            autoContrastState = new FirstPointSelection(this);
        }

        public void ImageMouseDown(object sender, MouseEventArgs e)
        {
            autoContrastState.MouseDown(sender, e);
        }

        public void ImageMouseUp(object sender, MouseEventArgs e)
        {
            autoContrastState.MouseUp(sender, e);
        }

        public void ImageMouseMoved(object sender, MouseEventArgs e)
        {
            autoContrastState.MouseMoved(sender, e);
        }
        
        public void ImagePainted(object sender, PaintEventArgs e)
        {
            autoContrastState.ImagePainted(sender, e);
        }

        public void SetAutoContrastState(Canvas2DAutoContrastState state)
        {
            this.autoContrastState = state;
        }

        public void RefreshCanvas()
        {
            canvas2DGui.Refresh();
        }

        public void SetCursor(Cursor cursor)
        {
            canvas2DGui.Cursor = cursor;
        }

        public void Notify()
        { 
        
        }

    }
}
